const startTime = Date.now();
console.log('执行content.js', startTime)
window.addEventListener('beforeunload', function (e) {
    const endTime = Date.now();
    const duration = (endTime - startTime)/1000;
    e.preventDefault();
    e.returnValue = "关闭";
    chrome.runtime.sendMessage({ url:location.href,duration:duration}, function (response) {
        console.log(response.farewell);
    });
})